package com.yuanfengPlus.basicInfoManage.customerInfo.contorller;


import com.yuanfengPlus.basicInfoManage.customerInfo.model.CustomerDto;
import com.yuanfengPlus.basicInfoManage.customerInfo.model.Customerinfo;
import com.yuanfengPlus.basicInfoManage.customerInfo.service.impl.CustomerinfoserviceImpl;
import com.yuanfengPlus.utils.PageResult;
import com.yuanfengPlus.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
@CrossOrigin
@Api(tags = "客户信息管理")
public class CustomerCon {
    @Autowired
    CustomerinfoserviceImpl ciil;


    // 查询全部客户信息
    @PostMapping("/selectCustomerAll")
    @ApiOperation(value = "查询全部客户")
    public Result<PageResult> selectCustomerAll(@RequestBody CustomerDto customerDto){
        return Result.success(ciil.selectCustomerAll(customerDto));
    }

    // 添加客户信息
    @PostMapping("/addCustomer")
    @ApiOperation(value = "添加客户")
    public Result<String> addCustomer(@RequestBody Customerinfo customerinfo){
        return ciil.addCustomer(customerinfo);
    }

    // 修改客户信息
    @PostMapping("/updateCustomer")
    @ApiOperation(value = "修改客户")
    public Result<String> updateCustomer(@RequestBody Customerinfo customerinfo){
        return ciil.updateCustomer(customerinfo);
    }

    // 查询单个客户信息
    @PostMapping("/selectCustomer")
    @ApiOperation(value = "查询单个客户")
    public Result<Customerinfo> selectCustomer(String id){
        return ciil.selectCustomer(id);
    }
}
